﻿@model Everynet.Models.OrdersModel
@{
    ViewBag.Title = "Orders";
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}
    <br />
<u class="headerColor">Orders</u>
<p>
@Html.ActionLink("Dashboard", "Dashboard","Admin")</p>
@using (Html.BeginForm())
{    
    <p>
        Name: @Html.TextBox("SearchString")&nbsp;&nbsp;
        <input type="submit" value="Filter" /></p> 
}
<table class="table-data" cellpadding="0" cellspacing="0" border="0" width="100%">
    <thead>
        <tr>
         <th align="left" class="header grdIDWidth4">
               ID
            </th>
            <th align="left" class="header">
                Customer Name
            </th>
           
            <th align="left" class="header grdIDWidth10">
               Total Cost
            </th>
            
            <th align="left" class="header grdIDWidth">
                Status
            </th>
             <th align="left" class="header grdIDWidth17">
                Registered DateTime
            </th>
            <th align="left" class="header grdIDWidth10">
               IP Address
            </th>
           <th align="left" class="header grdEditWidth">
               
            </th>
          
        </tr>
    </thead>
    <tbody>
        @foreach (var item in Model.listOrders)
        {
            <tr>
            <td>
                @Html.DisplayFor(modelItem => item.ID)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.FirstName) &nbsp;
                     @Html.DisplayFor(modelItem => item.LastName)
                </td>
               
                <td>
               @if (!String.IsNullOrEmpty(item.TotalCost.ToString()))
               {
                @("$")  @Html.DisplayFor(modelItem => item.TotalCost)
               }
                </td>
                 <td>
                  @if (String.IsNullOrEmpty(item.OrderStatus.ToString()) || item.OrderStatus.ToString() == "0")
                  {
                 <b> @("New")</b>
                  }
                  else if (item.OrderStatus.ToString()=="1")
                  {
                  <b> @("Payment Received")</b>
                  }
                  else if (item.OrderStatus.ToString() == "2")
                  {
                 <b> @("Connection Connected")</b>
                  }
                </td>
                <td>
                 @Html.DisplayFor(modelItem => item.RegisterDateTime)
                </td>
                <td>
                 @Html.DisplayFor(modelItem => item.IPAddress)
                </td>
                <td>@Html.ActionLink("Edit", "EditOrders", new { id = item.ID }) |
                @Html.ActionLink("Detail", "DetailOrders", new { id = item.ID })
                </td>
                
            </tr>
        }
    </tbody>
</table>
<script src="@Url.Content("~/Scripts/TableSort.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/tablepaging.js")" type="text/javascript"></script>

<script src="@Url.Content("~/Scripts/admin/common.js")" type="text/javascript"></script>